package app.foodnote;

import android.media.AudioRecord.OnRecordPositionUpdateListener;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {

	Button btnPlaces;
	Button btnSearch;
	Button btnReport;
	Button btnHelp;
	Button btnAbout;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		btnPlaces = (Button) findViewById(R.id.btnPlaces);
		btnSearch = (Button)findViewById(R.id.btnSearch);
		btnReport = (Button) findViewById(R.id.btnReport);
		btnHelp = (Button) findViewById(R.id.btnHelp);
		btnAbout = (Button) findViewById(R.id.btnAbout);
		
		OnClickListener places = new OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent a = new Intent(MainActivity.this, FoodPlaces.class);
				startActivity(a);
			}
		};
		
		OnClickListener search = new OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent a = new Intent(MainActivity.this,FoodSearch.class);
				startActivity(a);
			}
		};
		
		OnClickListener report = new OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				//Intent b = new Intent(MainActivity.this, formreport.class);
				Intent b = new Intent(MainActivity.this, Places_Report.class);

				startActivity(b);
			}
		};
		OnClickListener help = new OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent b = new Intent(MainActivity.this, formhelp.class);
				startActivity(b);
			}
		};
		OnClickListener about = new OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent b = new Intent(MainActivity.this, formabout.class);
				startActivity(b);
			}
		};
		btnPlaces.setOnClickListener(places);
		btnSearch.setOnClickListener(search);
		btnReport.setOnClickListener(report);
		btnHelp.setOnClickListener(help);
		btnAbout.setOnClickListener(about);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item){
		if(item.getItemId()==R.id.exit){
			finish();
			System.exit(0);
		}
		return (super.onOptionsItemSelected(item));
		
	}
	

}
